<!DOCTYPE html>
<html>
<head>
	<title>照片书-编辑内容</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="yes" name="apple-touch-fullscreen">
	<meta content="telephone=no,email=no" name="format-detection">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/normalize.css" type="text/css">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/photo_edit.css" type="text/css">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/photoNew.css" type="text/css">
	<link rel="stylesheet" href="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/css/p_edit.css" type="text/css">
	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jquery.min.js"></script>
	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jQueryRotate.js"></script>
	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/exif.js" ></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/jisuan.js"></script>
	<style type="text/css">
		.new_center{
			width:100%;
			height:2.0rem;
			background:#000;
			opacity: 0.7;
			color:#fff;
			font-size:0.266667rem;
			text-align: center;
			position: absolute;
			top:0.32rem;
			left:0;
			line-height:2.0rem;
			display: none;
		}
		.uploadImg {
			display: block;
			width: 65%;
			height: .6rem;
			line-height: .6rem;
			background-color: #63e0ce;
			color: #fff;
			position: absolute;
			bottom: .05rem;
			left: .1rem;
			font-size: .25rem;
			font-weight: normal;
			border-radius: 0.1rem;
			text-align: center;
		}
		#file1,#file2,#file3 {
			position: absolute;
			width: 65%;
			height: .6rem;
			bottom: .05rem;
			left: .1rem;
			opacity: 0;
			filter: alpha(opacity = 0);
			cursor: pointer;
		}
		.imgbox1{
			width: 2.63rem;
			height: 1.7rem;
			position: absolute;
			top: 1.36rem;
			left: .05rem;
			overflow: hidden;
		}
		.imgbox2{
			width: 2.4rem;
			height: 2.48rem;
			position: absolute;
			top: 0;
			left: 0.38rem;
			overflow: hidden;
		}
		.imgbox3{
			width: 1.84rem;
			height: 2.8rem;
			position: absolute;
			top: 0.34rem;
			left: 0.24rem;
			overflow: hidden;
		}
		.prompt{
			width: 0.6rem;
			height: 1rem;
			position: absolute;
			right: 0.1rem;
			top: 10.95rem;
		}
		.prompt img {
			width: 100%;
		}
		.main_top{
			position: relative;
		}
		#toprev,#tonext{
			width: 2.0266666rem;
			height: 0.74666666rem;
			position: absolute;
			top: 11.21333333rem;
			z-index: 10;
			text-align: center;
			box-shadow: 0 2px 2px rgba(140,140,140,0.5);
		}
		#toprev{
			right: 2.96rem;
			background: url(http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_previous_page_btn_nor.png) no-repeat 20% center;
			background-size: 90% 130%;
		}
		#tonext{
			right: 0.9333333rem;
			background: url(http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_next_page_btn_nor.png) no-repeat 20% center;
			background-size: 90% 130%;
		}
		/*横条样式*/
		#gundong{
			-webkit-appearance: none;/*清除系统默认样式*/
			width: 100%;
			height: 0.16rem;/*横条的高度*/
			background: -webkit-linear-gradient(#63E0CE, #63E0CE) no-repeat, #ddd;/*设置左边颜色为#61bd12，右边颜色为#ddd*/
			background-size: 0 100%;/*设置左右宽度比例*/
			outline: none;
			border-radius: 4px;
			margin: 0.25rem 0;
		}
		/*拖动块的样式*/
		#gundong::-webkit-slider-thumb {
			-webkit-appearance: none;/*清除系统默认样式*/
			height: 0.48rem;/*拖动块高度*/
			width: 0.48rem;/*拖动块宽度*/
			background: #fff;/*拖动块背景*/
			border-radius: 50%; /*外观设置为圆形*/
			box-shadow: 0 0 5px rgba(128,128,128,0.5);  /*设置阴影*/
			border: none;
		}
		.tishi1,.tishi2,.tishi3{
			position: absolute;
			top: 1.62rem;
			font-size: 0.4rem;
		}
		.tishi1{
			color: #fff;
			left: 0.2rem;
		}
		.tishi2{
			color: #000;
			left: 0.2rem;
		}
		.tishi3{
			color: #000;
			left: 0.2rem;
		}
		.shape_0{ 	/*长图	width/height	*/
			position: absolute;
			height: 100%;
			left: 50%;
			top: 0;
			transform: translate(-50%);
		}
		.shape_1{ 	/*方图*/
			position: absolute;
			height: 100%;
			/*width: 100%;*/
			left: 50%;
			top: 0;
			transform: translate(-50%);
		}
		.shape_2{ 	/*横图*/
			position: absolute;
			width: 100%;
			left: 0;
			top: 50%;
			transform: translate(0,-50%);
		}
		#uploadingField{
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			background-color: #000;
			filter: alpha(opacity=60);
			opacity: 0.6;
			z-index: 99;
			display: none;
		}
		#uploading{
			width: 6rem;
			height: 3rem;
			background-color: #000;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
		}
		#uploading img{
			width: 20%;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-70%);
		}
		#uploading p{
			width: 80%;
			position: absolute;
			bottom: 10%;
			left: 50%;
			transform: translate(-50%);
			font-size: .4rem;
			text-align: center;
			color: #ccc;
			margin:0;
		}
		.rotate{
			position: absolute;
			margin-top:45%;
			margin-left:41%;
		}
		/*.pirc_img{
			width: 100px; 
			height: 80px; 
			position: absolute; 
			top: 50%; 
			left: 50%; 
			/*margin: -40px 0 0 -50px; */
		/*}*/
		.transform_1{
			transform: rotate(90deg);
			transform-origin: 50% 50% 0px;
		}
		.transform_2{
			transform: rotate(180deg);
			transform-origin: 50% 50% 0px;
		}
		.transform_3{
			transform: rotate(270deg);
			transform-origin: 50% 50% 0px;
		}
		.transform_4{
			transform: rotate(0deg);
			transform-origin: 50% 50% 0px;
		}
	</style>
</head>
<body>
<div class="container">
	<div class="main">
		<div class="main_top" onchange="savetext()">
			<div class="prompt"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_content_pull_up.png" alt=""></div>
			<div id="toprev"></div>
			<div id="tonext"></div>
			<div class="top_img">
				<if condition="$blank eq 1">
					<div class="top_container imgDiv" data-page="0">
						<input type="hidden" name="" class="status1" value="1">
					</div>
				</if>
				<volist name="photoStatus" id="vv">
					<div class="top_container imgDiv" data-page="{$vv.inPage}">
						<input type="hidden" name="" class="status{$vv.inPage}" value="{$vv.status}">
							<textarea placeholder="点击此处输入文字"
									  class="textarea text{$vv.inPage} text{$vv.inPage}_top {$vv.zimu}_text_{$vv.status}_top">{$vv.text}</textarea>
							<textarea placeholder="点击此处输入文字"
									  class="textarea text{$vv.inPage} text{$vv.inPage}_bottom {$vv.zimu}_text_{$vv.status}_bottom">{$vv.text1}</textarea>
						<volist name="vv.photoContent" id="vi" key="k">
							<div class="pirc numBer{$vv.inPage} {$vv.zimu}_move{$vi.yw}_{$vv.status}">
								<div class="fee100 transform_{$vi.transform}" data-shape="{$vi.shape}"id="d_{$vi.photoId}">
									<img class="pirc_img " data-src="{$vi.img}">
									<div class="feel_zhao">
										<div class="weitiao feel_absolute ">
											<!--<div class="wei_img feel_absolute ">
                                                 <img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_adjust_position_icon.png" class="weitiao_img">
                                                <div class="wei_text">拖动微调</div>
                                            </div> -->
											<div class="feel_sure feel_absolute" onclick="sure(this,{$vi.photoId})" data-photoid="{$vi.photoId}">
												<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_carry_out_adjust_position_icon.png" class="weitiao_img">
												<div class="wei_text">点击确认</div>
											</div>
											<div class="feel_huan feel_absolute" onclick="huanwei(this,'{$vi.yw}')" data-yw="{$vi.yw}">
												<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_transposition_icon.png" class="weitiao_img">
												<div class="wei_text">点击换位</div>
											</div>
										</div>
										<div class="wt"></div>
									</div>
									
								</div>
								<div class="tiaozheng">
										<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_delete_btn_nor.png" class="kai_delete" onclick="deleteImg(this,{$vi.photoId})" data-photoid="{$vi.photoId}">
										<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/rotate.png" alt="" class="rotate" onclick="rotateImg(this,{$vi.photoId})" >
										<!-- <img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_adjust_position_btn_nor.png" class="kai_img" onclick="weitiao(this,'{$vi.yw}')" data-yw="{$vi.yw}"> -->
									</div>
							</div>
						</volist>
					</div>
				</volist>

			</div>
			<div class="main_top_text">
				<output class="yeshu" >1</output>/<span class="zongshu">{$countPage}</span>
				<input type="hidden" name="" value="" class="chang">
			</div>
			<div class="bar">
				<input type="range" min="1" max="{$countPage}" data-rangeslider value="" id="gundong">

				<!-- <div class="barBack"></div>
                <div class="barRadius"></div> -->
			</div>
		</div>
		<div class="main_container">
			<div class="mo_container">
				<div class="moban none">
					<div class="moban_main">
						<div class="mobanNav">内页页脚风格</div>
						<div class="moStyle">
							<input type="hidden" id="pbStyle" value="{$pbook.style}">
							<volist name="photoStyle" id="v">
								<if condition="$pbook.style eq $v['pbsId']">
									<div class="styleText left styleColor" data-pbtitle="{$v.pbTitle}" data-pbsid="{$v.pbsId}" onclick="changePbStyle({$v.pbsId},this)">{$v.styleName}</div>
									<else/>
									<div class="styleText left" data-pbtitle="{$v.pbTitle}" data-pbsid="{$v.pbsId}" onclick="changePbStyle({$v.pbsId},this)">{$v.styleName}</div>
								</if>
							</volist>
						</div>
					</div>
				</div>
				<div class="main_cover none">
					<div class="cover">
						<div class="coverTop">
							<div class="coverNav">选择的封面对封面对编辑将会实时生效哦</div>
							<div class="bookName">
								<span class="book_name left">作品书名</span>
								<input type="text" name="" class="inputName right" placeholder="请输入作品书名" value="{$pbook.bookName}" id="bookName" maxlength="9">
							</div>
							<div class="biaoName">
								<span class="biao_name left">副标题</span>
								<input type="text" name="" class="inputbiao right" placeholder="请输入副标题或者作者名字" value="{$pbook.title}" id="title" maxlength="8">
							</div>

						</div>
						<div class="coverBot">
							<div class="coverImg">
								<div class="xuanze">选择封面</div>
								<div class="coverStyle">
									<volist name="photoCover" id="vo" offset="0" length='9'>
										<div class="cover_style left">
											<div class="cover_style_img"><img src="http://www.youyiku-yishu.cn/{$vo.image}" class="img">
											</div>
											<if condition="$pbook.coverId eq $vo['id']">
												<div class="cover_style_top" data="{$vo.id}">
													<else/>
													<div class="cover_style_top" data="{$vo.id}">
											</if>
											<if condition="$pbook.coverId eq $vo['id']"><div class="coverTure cover_cur" data="{$vo.id}">
												<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_cover_selected_cover_icon_sel.png" class="img">
											</div><else/><div class="coverTure" data="{$vo.id}">
												<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_cover_selected_cover_icon_sel.png" class="img">
											</div></if>

										</div>
								</div>
								</volist>
							</div>
							<volist name="photoCover" id="vs">
								<if condition="$vs['cId'] eq 1"><if condition="$vs['pbId'] eq $pbId">
									<input type="hidden" value="{$vs['image']}" id="imagebox1">
									<input type="hidden" value="{$vs['shape']}" id="imageboxShape1">
								</if></if>

								<if condition="$vs['cId'] eq 2"><if condition="$vs['pbId'] eq $pbId">
									<input type="hidden" value="{$vs['image']}" id="imagebox2">
									<input type="hidden" value="{$vs['shape']}" id="imageboxShape2">
								</if></if>

								<if condition="$vs['cId'] eq 3"><if condition="$vs['pbId'] eq $pbId">
									<input type="hidden" value="{$vs['image']}" id="imagebox3">
									<input type="hidden" value="{$vs['shape']}" id="imageboxShape3">
								</if></if>
							</volist>
						</div>
					</div>
				</div>
			</div>
			<div class="main_bot">
				<div class="main_bot_text">
					<!-- 「编辑操作说明」点击上面图中
                    <span class="shangchuan"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/1506665484(1).jpg" class="img"></span>
                    可裁剪或调换位置 -->
				</div>
				<div class="edit">
					<div class="duo" id="reserved">
						<div class="fang left sc">
							<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_upload_photos_btn_nor.png" class="img" id="uploadphoto" />
							<span class="tishi1">添加图片</span>
							<!--<input type="file" id="uploadImg" onchange="selectFileImage(this);" class="uploadfile-input" accept="image/*">-->
							<div class="imglist" id="previewImage"></div>
							<input type="hidden" id="img_str" name="img_str">
							<div id="imageUrl"></div>
						</div>
						<div class="fang left qh">
							<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_transposition_btn_nor.png" class="img" />
							<span class="tishi2">一键换位</span>
						</div>
						<div class="fang left allUpload">
							<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/allImageUpload.png" class="img" />
							<span class="tishi3">一键排版</span>
						</div>
						<volist name="reserve" id="vv" key="k">
							<div class="fang left">
								<input type="hidden" name="photoId" value="{$vv.photoId}">
								<div class="new_book select_{$k}">
									<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/select.png" class="new_img">
									<div class="new_text new_left" onclick="inNewPage({$vv.photoId},this)">新起页</div>
									<div class="new_text new_right" onclick="sureDelPhoto({$vv.photoId},this)">删除</div>
								</div>
								<div class="new_center center_{$k}" onclick="inBook({$vv.photoId},this)">当前页</div>
								<img src="http://www.youyiku-yishu.cn/{$vv.img}" class="img" onclick="showSelect({$k},this)">
							</div>
						</volist>
					</div>
				</div>
			</div>
		</div>

	</div>
</div>

<div class="footer">
	<div class="footer_main">
		<input type="hidden" id="pbId" value="{$pbook.photoBookId}">
		<div class="footer_true left" onclick="saveCurrent({$pbook.photoBookId})">
					<span class="true">
						<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photo_book_edit_the_content_carry_out_icon.png" class="img">
					</span>
			完成
		</div>
		<div class="footer_three left">
			<div class="footer_moban left">选择页脚</div>
			<div class="footer_cover left">编辑封面</div>
			<div class="footer_edit left footer_Color">编辑内容</div>
		</div>

	</div>
</div>
</div>
<div class="am-g wst-msg-modal" id="wst-msg-modal">
	<div class="wst-modal-content" id="wst-modal-content"></div>
</div>
<div class="wst-to-top" id="toTop">
	<i class="am-icon-arrow-up wst-to-top-icon"></i>
</div>
<div id="uploadingField">
	<div id="uploading">
		<img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/loading.gif" alt="loading">
		<p>正在排版中，请稍等...</p>
	</div>
</div>

<script type="text/javascript" src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/newPhoto.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/iscroll-zoom.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/hammer.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/Photoclip/jquery.photoClip.js"></script>
<script>
	var pbId=$('#pbId').val();
	var curPage=localStorage.getItem('curPage'+pbId);
	var cp = Number(curPage);
	var zong = $('.zongshu').text(); //总页数
	if(curPage==null){
		curPage=1;
		localStorage.setItem('curPage'+pbId,1);
	}
	if(Number(zong)>1){
		localStorage.setItem("uploadImgPage"+pbId,zong);
	}else{
		localStorage.setItem("uploadImgPage"+pbId,"0");
	}

	$(function(){
		//进度条
		$('#gundong').on("change",change);
		$('.yeshu').text( curPage );
		$('#gundong').val( curPage );
		$("#gundong").css({
			"backgroundSize": ($('#gundong').val()-1)*100/(zong-1)+"%"+" 100%"
		});
		$(".imgDiv").eq( Number(curPage)-1 ).show().addClass("curpage_active").siblings().hide()

		lazyload();

		//js添加两个封面上的盒子
		var boximg1=$('#imagebox1').val();
		var boximg2=$('#imagebox2').val();
		var boximg3=$('#imagebox3').val();
		var boxShape1=$("#imageboxShape1").val();
		var boxShape2=$("#imageboxShape2").val();
		var boxShape3=$("#imageboxShape3").val();
		var box1 = document.querySelectorAll(".cover_style_top")[0];
		var box1_img = document.querySelectorAll(".cover_style_img")[0];
		var box2 = document.querySelectorAll(".cover_style_top")[1];
		var box2_img = document.querySelectorAll(".cover_style_img")[1];
		var box3 = document.querySelectorAll(".cover_style_top")[2];
		var box3_img = document.querySelectorAll(".cover_style_img")[2];
		if(boximg1!=undefined){
			var str_img = '<div  class="imgbox imgbox1" style="background-color:#fff;"><img class="shape_'+boxShape1+'" src=http://www.youyiku-yishu.cn/'+boximg1+'></div>';
		}else{
			var str_img = '<div  class="imgbox imgbox1"></div>';
		}
		if(boximg2!=undefined){
			var str_img2 = '<div  class="imgbox imgbox2" style="background-color:#fff;"><img class="shape_'+boxShape2+'" src=http://www.youyiku-yishu.cn/'+boximg2+'></div>';
		}else{
			var str_img2 = '<div  class="imgbox imgbox2"></div>';
		}
		if(boximg3!=undefined){
			var str_img3 = '<div  class="imgbox imgbox3" style="background-color:#fff;"><img class="shape_'+boxShape3+'" src=http://www.youyiku-yishu.cn/'+boximg3+'></div>';
		}else{
			var str_img3 = '<div  class="imgbox imgbox3"></div>';
		}

		var str1 = '<span class="uploadImg" style="display:block">可上传图片</span><input id="file1" type="button">';
		var str2 = '<span class="uploadImg">可上传图片</span><input id="file2" type="button">';
		var str3 = '<span class="uploadImg">可上传图片</span><input id="file3" type="button">';


		box1.innerHTML+=str1;
		box2.innerHTML+=str2;
		box3.innerHTML+=str3;
		box1_img.innerHTML+=str_img;
		box2_img.innerHTML+=str_img2;
		box3_img.innerHTML+=str_img3;

		//添加max-length限制
		$(".a_text_1_top").attr('maxlength','150');
		$(".a_text_1_bottom").attr('maxlength','150');
		$(".a_text_2_top").attr('maxlength','150');
		$(".a_text_2_bottom").attr('maxlength','150');

		$(".b_text_1_top").attr('maxlength','50');
		$(".b_text_1_bottom").attr('maxlength','50');
		$(".b_text_2_top").attr('maxlength','50');
		$(".b_text_2_bottom").attr('maxlength','50');

		$(".c_text_1_top").attr('maxlength','50');
		$(".c_text_1_bottom").attr('maxlength','50');
		$(".c_text_2_top").attr('maxlength','50');
		$(".c_text_2_bottom").attr('maxlength','50');

		$(".d_text_1_top").attr('maxlength','45');
		$(".d_text_1_bottom").attr('maxlength','50');
		$(".d_text_2_top").attr('maxlength','45');
		$(".d_text_2_bottom").attr('maxlength','50');

		$(".e_text_1_top").attr('maxlength','50');
		$(".e_text_1_bottom").attr('maxlength','50');
		$(".e_text_2_top").attr('maxlength','50');
		$(".e_text_2_bottom").attr('maxlength','50');
	});

	//进度条
	function change(){
		var rangevalue = $('#gundong').val();
		$('.yeshu').text( rangevalue )
		$("#gundong").css({
			"backgroundSize": ($('#gundong').val()-1)*100/(zong-1)+"%"+" 100%"
		});
		$(".imgDiv").eq( Number(rangevalue)-1 ).show().addClass("curpage_active").siblings().removeClass("curpage_active").hide();
		lazyload();
	};

	//懒加载
	function lazyload(){
		if(Number(zong)<=5){
			$(".imgDiv").each(function(){
				$(this).find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				})
			})
		}else{  //总页数>5
			if( cp ){ //
				//当前页
				$(".imgDiv").eq(cp-1).find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});
				//当前页的前一页
				if(cp<2){ cp=2 }
				$(".imgDiv").eq(cp-2).find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});
				//当前页的后一页
				$(".imgDiv").eq(cp ).find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});
				cp = 0;
			}else{
				//当前页
				$(".imgDiv").filter(".curpage_active").find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});
				//当前页的前一页
				$(".imgDiv").filter(".curpage_active").prev().find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});
				//当前页的后一页
				$(".imgDiv").filter(".curpage_active").next().find(".pirc_img").each(function(){
					var data_src = $(this).data("src");
					var data_shape = $(this).data("shape");
					$(this).attr("src","http://www.youyiku-yishu.cn/"+data_src);
					if(data_shape == 0){
						$(this).attr("style","height:100%;position:absolute;top:0;left:50%;transform: translate(-50%,0);");
					}else if(data_shape == 1){
						$(this).attr("style","height:100%;width:100%");
					}else{
						$(this).attr("style","width:100%;position:absolute;top:50%; left:50%;transform: translate(-50%,-50%);");
					}
				});

			}

		}
	}

	function saveCurrent(id){
		var param={};
		param.pbId=id;

		var page=$('.yeshu').val();
		param.page=page;
		param.text=$('.text'+String(page)+'_top').val();
		param.text1=$('.text'+String(page)+'_bottom').val();
		param.bookName=$('#bookName').val();
		param.title=$('#title').val();
		param.coverId=$('.cover_cur').attr('data');
		param.style=$('.styleColor').data("pbsid");

		$.post(Think.U('WebApp/PhotoBooks/saveCurrent'),param, function(data){
			if(data.status==1){
				location.href=WST.U('WebApp/PhotoBooks/index','photoBookId='+id);
			}
		});
	}
	var WST = ThinkPHP = window.Think = {
		"ROOT"   : "__ROOT__",
		"APP"    : "__APP__",
		"PUBLIC" : "__PUBLIC__",
		"DEEP"   : "{:C('URL_PATHINFO_DEPR')}",
		"MODEL"  : ["{:C('URL_MODEL')}", "{:C('URL_CASE_INSENSITIVE')}", "{:C('URL_HTML_SUFFIX')}"],
		"VAR"    : ["{:C('VAR_MODULE')}", "{:C('VAR_CONTROLLER')}", "{:C('VAR_ACTION')}"],
		"DEFAULT_IMG": "{:WSTDomain()}/{$CONF['goodsImg']}",
	}
</script>
<script src="__PUBLIC__/js/think.js?v={$WST_V}"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/AmazeUI/assets/js/amazeui.min.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/fastclick.min.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/echo.min.js"></script>
<script src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/js/common.js?v={$WST_V}"></script>

<script type="text/javascript">

	//加载页面时获取当前页页码
	window.PAGE="";
	window.first="";
	$(function(){
		var page=$('.yeshu').val();
		PAGE=page;
	})


	//保存写入的文本
	function savetext(){
		var pbId=$('#pbId').val();
		var page=$('.yeshu').val();
		var text=$('.text'+String(PAGE)+'_top').val();
		var text1=$('.text'+String(PAGE)+'_bottom').val();

		$.ajax({
			type: "get",//数据发送的方式（post 或者 get）
			url: " {:U('PhotoBooks/savecontent')}",//要发送的后台地址
			data:{'pbId':pbId,'page':PAGE,'text':text,'text1':text1},//要发送的数据（参数）格式为{'val1':"1","val2":"2"}
			dataType: "json",//后台处理后返回的数据格式
			success:function(data){
				PAGE=page;
			}
		})
	}

	//点击一下就显示cover_cur
	$(".cover_style_top").each(function(){
		$(this).on("click",function (){
			$(".coverTure").removeClass("cover_cur");
			$(this).find(".coverTure").addClass("cover_cur");
		});
	})

	//所有图片上传
	$(".allUpload").on("click",function(){

		setTimeout(uploadAll,500);
	});

	//新创建时，如果他在第一页上传了图片，然后剩下的点击一键排版，可能会出现多张图片的inpage，direction出现一样的值
	function uploadAll(){
		var divArr = $(".fang").eq(2).nextAll();
		var divArrlength = divArr.length;
		if(divArrlength != 0){ //如果无图片可上传
			var hH = window.screen.height;
			$("#uploadingField").css("height",hH).show();
		}
		var uploadimgall_page = 1;
		var uploadcontrol = Number( $(".zongshu").text() ); //第一次点击一键排版时， = 1；
		var randomNumber_first = selectRandomNumber();
		var direction=[1,2,3,4,5];
		var clickcount =Number( localStorage.getItem("clickcount"+pbId) );
		var isempty = $(".fee100").children("img").length;
		if(divArrlength == 0){ //如果无图片可上传
			wstMsg("没有可上传的图片!");

		}else{
			if(clickcount>1 || uploadcontrol>1 || isempty>0){
				localStorage.setItem("clickcount"+pbId,2);
				addNewPage();
			}else{
				uploadimgall(randomNumber_first,uploadimgall_page,direction);
			}
		}
		function selectRandomNumber(){
			var randomNumber = Math.floor( Math.random()*5+1 ); //1-3
			return randomNumber;
			console.log("randomNumber:"+randomNumber);
		}
		function uploadimgall(randomNumber,page,direction){
			var photoId,inBookDiv,i=0;
			if(page > 1){
				uploadimgall_page = page;
			}
			if(divArrlength <= 5){		//最后三张图片时的排版
				if(divArrlength == 5){
					randomNumber = 5;
				}else if(divArrlength == 4){
					randomNumber = 4;
				}else if(divArrlength == 3){
					randomNumber = 3;
				}else if(divArrlength == 2){
					randomNumber = 2;
				}else{
					randomNumber =1;
				}
				for(i=0; i<=randomNumber; i++){
					photoId = $(divArr[i]).children("input").val();
					inBookDiv = $(divArr[i]).find(".new_center");

					if(i == randomNumber){
						//这里代表最后一页已经添加完图片，直接返回;
						localStorage.setItem("isUploadAll",false);
						wstMsg("所有图片已上传！");
						/*$("#uploadingField").hide();*/
						setTimeout( window.location.reload(),500);
					}else{
						inBook1(photoId,inBookDiv,uploadimgall_page,direction[i]);
						divArrlength --;
					}
				}
			}else{
				for(i=0; i<=randomNumber; i++){
					photoId = $(divArr[i]).children("input").val();
					//alert("photoId:"+photoId);
					inBookDiv = $(divArr[i]).find(".new_center");

					if(i == randomNumber){
						//这里代表本页面已经添加完图片，执行addNewPage();
						addNewPage();
					}else{
						inBook1(photoId,inBookDiv,uploadimgall_page,direction[i]);
						divArrlength --;
					}
				}
			}
		}
		//添加新页面
		function addNewPage(){
			var pbId=$('#pbId').val();
			$.ajax({
				type:"post",
				url:WST.U('WebApp/PhotoBooks/addPage'),
				async:false,
				data:{'photoBookId':pbId},
				success:function(json){
					//alert("json.newPage:"+json.newPage);
					if(json.status==1){
						divArr = $(".fang").eq(2).nextAll();
						//var direction=[1,2,3];
						var randomNum = selectRandomNumber();
						uploadimgall(randomNum,json.newPage,direction);
					}
				},
				error:function(err){
					alert("添加新页出现错误");
				}
			})
		}
		//增加图片进页面
		function inBook1(id,param,page,direction){
			var pbId = $("#pbId").val();

			//当前页的移动状态
			var curStatus=$('.status'+page).val();
			var curPage=['One','Two','Three','Four','Five'];
			var zimu=['a','b','c','d','e'];
			//风格
			var styleId=$('#pbStyle').val();
			var fengUrl='';
			//先去后台判断当前页是否满3张照片
			// alert("page:"+page);
			$.ajax({
				type:"post",
				url:WST.U('WebApp/PhotoBooks/checkPageIsFull'),
				async:false,
				data:{"page":page,"pbId":pbId,"photoId":id},
				success:function(json){
					//alert("json:"+json.status);

					var str='';
					//第一张照片有空位
					if(json.status==1 || json.status==2 || json.status==3|| json.status==4|| json.status==5){
						//移除预留的照片
						$(param).parent().remove();
						//数据库保存的照片并在书页上显示
						var obj={};
						obj.page=page;
						obj.photoId=id;
						obj.direction=direction;
						//alert(JSON.stringify(obj))
						$.ajax({
							type:"post",
							url:WST.U('WebApp/PhotoBooks/photoInsertPage'),
							async:false,
							data:{"page":page,"photoId":id,"direction":obj.direction,first:first},
							success:function(data){
								first=data.ps;
								// alert(JSON.stringify(data));
								if(data.status==1){
									str+='<div class="pirc numBer'+page+' a_moveOne_'+curStatus+'">';
									str+='<div class="fee100">';
									str+='<img src="'+WST.ROOT+'/'+json.img+'" class="pirc_img" data-shape="'+data.shape+'">';
									str+='<div class="feel_zhao">';
									str+='<div class="weitiao feel_absolute ">';
									str+='<div class="wei_img feel_absolute ">';
									/*str+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/photo_book_edit_the_content_adjust_position_icon.png" class="weitiao_img">';
									 str+='<div class="wei_text">拖动微调</div>';*/
									str+='</div>';
									str+='<div class="feel_sure feel_absolute" onclick="sure(this,'+id+')">';
									str+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/photo_book_edit_the_content_carry_out_adjust_position_icon.png" class="weitiao_img">';
									str+='<div class="wei_text">点击确认</div>';
									str+='</div>';
									str+='<div class="feel_huan feel_absolute" onclick="huanwei(this,\'One\')">';
									str+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/photo_book_edit_the_content_transposition_icon.png" class="weitiao_img">';
									str+='<div class="wei_text">点击换位</div>';
									str+='</div>';
									str+='</div>';
									str+='<div class="wt"></div>';
									str+='</div>';
									str+='<div class="tiaozheng">';
									str+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/photo_book_edit_the_content_delete_btn_nor.png" class="kai_delete" onclick="deleteImg(this,'+id+')">';
									str+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/photo_book_edit_the_content_adjust_position_btn_nor.png" class="kai_img"  onclick="weitiao(this,\'One\')">';
									str+='</div>';
									str+='</div></div>';
								}
								$('.imgDiv').eq(page-1).append(str);

								//图片的移动

								var _x_start,_y_start,_x_move,_y_move,_x_end,_y_end,left_start,top_start, marginLeft, marginTop,width,height;

								//监听多个，相同的类
								var yiDong=[];
								var yidong = $('.wt');
								for(var k=0;k<yidong.length;k++){
									yiDong.push(yidong[k]);
									yiDong[k].addEventListener("touchstart",start);
									yiDong[k].addEventListener("touchmove",move);
									yiDong[k].addEventListener("touchend",end);
									document.getElementsByClassName('wt')[k].addEventListener('touchend', function(e){
										e.preventDefault();
									});
								}
								//手指开始触摸
								function start(e){
									_x_start=e.touches[0].pageX;
									_y_start=e.touches[0].pageY;

									left_start=$(this).parent().prev().css('marginLeft')
									top_start=$(this).parent().prev().css('marginTop');

									console.log(top_start);
								}
								//手指移动
								function move(e){
									_x_move=e.touches[0].pageX;
									_y_move=e.touches[0].pageY;
									marginLeft=parseInt(_x_move)-parseInt(_x_start)+parseInt(left_start);
									marginTop=parseInt(_y_move)-parseInt(_y_start)+parseInt(top_start);
									height=parseInt($(this).height()) * 0.05;
									width= parseInt($(this).width()) * 0.1;
									if(marginTop>20){
										marginTop=parseInt($(this).height())*0.02;
									}else if(marginTop<-20){
										marginTop='-'+parseInt($(this).height())*0.02;
									}
									$(this).parent().prev().css("marginLeft",marginLeft+"px");
									$(this).parent().prev().css("marginTop",marginTop+"px");
									//            console.log(parseInt(_y_move)-parseInt(_y_start)+parseInt(top_start));
								}
								//手指离开
								function end(e){
									var _x_end=e.changedTouches[0].pageX;
									var _y_end=e.changedTouches[0].pageY;


									$('body').removeClass('fixed');
									$('.wt').hide();
									$(this).prev().children('.wei_img').removeClass('Zindex');
									$(this).prev().children('.feel_sure').addClass('Zindex');
								}
							}
						});
					}else{
						wstMsg('此页面已满');
					}
				}
			})
		}
	};
	//更换风格图片
	changePbStyle($(".styleColor").data("pbsid"),document.getElementsByClassName('styleColor')[0]);
	function changePbStyle(id,obj){
		var pbtitle = obj.dataset.pbtitle;
		$(".imgDiv:odd").css({"background":"url(http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/pbStyle/"+pbtitle+"_odd_"+id+".png) no-repeat","backgroundSize":"100% 100%"});
		$(".imgDiv:even").css({"background":"url(http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/pbStyle/"+pbtitle+"_even_"+id+".png) no-repeat","backgroundSize":"100% 100%"});
	}
	//左右滑动
	//左右按钮
	var totalpg = $(".zongshu").text();
	if(totalpg === "1"){
		console.log("111")
		$("#toprev").off("click");
		$("#tonext").off("click");
	}else{
		$("#toprev").on("click",function(){
			var curpage_active = $(".imgDiv").filter(".curpage_active").data("page");
			if( curpage_active == 1 ){
				wstMsg("这已经是第一页了!");
				localStorage.setItem('curPage'+pbId,curpage_active);
			}else{
				$(".imgDiv").filter(".curpage_active").removeClass("curpage_active").fadeOut().prev().fadeIn().addClass("curpage_active");
				var page = curpage_active-1;           //16
				$('.yeshu').text( page );
				$('#gundong').val( page );
				$("#gundong").css({
					"backgroundSize": ( Number(page)-1 )*100/(zong-1)+"%"+" 100%"
				});
				localStorage.setItem('curPage'+pbId,page);
				lazyload();
			}
		})
		$("#tonext").on("click",function(){
			var curpage_active = $(".imgDiv").filter(".curpage_active").data("page");

			if( curpage_active == $(".imgDiv").length ){
				wstMsg("这已经是最后一页了!");
				localStorage.setItem('curPage'+pbId,curpage_active);
			}else{
				$(".imgDiv").filter(".curpage_active").removeClass("curpage_active").fadeOut().next().fadeIn().addClass("curpage_active");
				var page = curpage_active+1;
				$('.yeshu').text( page );
				$('#gundong').val( page );
				$("#gundong").css({
					"backgroundSize": ( Number(page)-1 )*100/(zong-1)+"%"+" 100%"
				});
				localStorage.setItem('curPage'+pbId,page);
				lazyload();
			}
		})
	}

</script>
<script>
	/*
	 * 注意：
	 * 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
	 * 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
	 * 3. 常见问题及完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
	 *
	 * 开发中遇到问题详见文档“附录5-常见错误及解决办法”解决，如仍未能解决可通过以下渠道反馈：
	 * 邮箱地址：weixin-open@qq.com
	 * 邮件主题：【微信JS-SDK反馈】具体问题
	 * 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。
	 */
	wx.config({
		debug: false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
	nonceStr: '<?php echo $signPackage["nonceStr"];?>',
			signature: '<?php echo $signPackage["signature"];?>',
			jsApiList: [
		// 所有要调用的 API 都要加到这个列表中
		'chooseImage','previewImage','uploadImage','downloadImage'
	]
	});
	var images = {
		localId: [],
		serverId: [],
		download:[]
	};

	var str='';
	wx.ready(function () {
		var pbId=$('#pbId').val();
		$("#file3").on("click",function(){
			var cId = 3;
			wx.chooseImage({
				count:1,
				sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				success:function(res){
					var localIds = res.localIds;// 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片

					function uploadCoverImg(){
						wx.uploadImage({
							localId:localIds[0],
							success:function(res){
								var serverId = res.serverId; // 返回图片的服务器端ID				

								$.post(Think.U('WebApp/PhotoBooks/saveCoverImg'),{media_id:res.serverId,pbId:pbId,cId:cId},function(json){
									console.log(json);
									$(".imgbox3 img").remove();
									var img = new Image();
									img.src = '/'+json.purl;
									img.className = "shape_"+json.shape;
									img.id = "ceshi";
									$(".imgbox3").css("backgroundColor","#fff").get(0).appendChild(img);
								})
							}
						})
					};
					uploadCoverImg();
				},
			})
		});
		$("#file2").on("click",function(){
			var cId = 2;
			wx.chooseImage({
				count:1,
				sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				success:function(res){
					var localIds = res.localIds;// 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片

					function uploadCoverImg(){
						wx.uploadImage({
							localId:localIds[0],
							success:function(res){
								var serverId = res.serverId; // 返回图片的服务器端ID
								$.post(Think.U('WebApp/PhotoBooks/saveCoverImg'),{media_id:res.serverId,pbId:pbId,cId:cId},function(json){
									console.log(json);
									$(".imgbox2 img").remove();
									var img = new Image();
									img.src = '/'+json.purl;
									img.className = "shape_"+json.shape;
									$(".imgbox2").css("backgroundColor","#fff").get(0).appendChild(img);
								})
							}
						})
					};
					uploadCoverImg();
				},
			})
		});
		$("#file1").on("click",function(){
			var cId = 1;
			wx.chooseImage({
				count:1,
				sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				success:function(res){
					var localIds = res.localIds;// 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片

					function uploadCoverImg(){
						wx.uploadImage({
							localId:localIds[0],
							success:function(res){
								var serverId = res.serverId; // 返回图片的服务器端ID
								$.post(Think.U('WebApp/PhotoBooks/saveCoverImg'),{media_id:res.serverId,pbId:pbId,cId:cId},function(json){
									console.log(json);
									$(".imgbox1 img").remove();
									var img = new Image();
									img.src = '/'+json.purl;
									img.className = "shape_"+json.shape;
									$(".imgbox1").css("backgroundColor","#fff").get(0).appendChild(img);
								})
							}
						})
					};
					uploadCoverImg();
				},
			})
		});
		$('#uploadphoto').click(function(){
			var logNumber='';
			// 在这里调用 API
			wx.chooseImage({
				count: 9, // 默认9
				sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				success: function (res) {
					images.localId = res.localIds;
					//alert(JSON.stringify(images.localId));
					var i = 0, length = images.localId.length;
					//images.serverId = [];

					function upload() {
						//解决IOS无法上传的坑
						if (images.localId[i].indexOf("wxlocalresource") != -1) {
							images.localId[i] = images.localId[i].replace("wxlocalresource", "wxLocalResource");
						}
						// setTimeout(wx.uploadImage,1000);
						wx.uploadImage({
							localId: images.localId[i],
							success: function(res) {
								i++;
								//alert(JSON.stringify(res));
								//images.serverId.push(res.serverId);
								//下载	
								$.post(Think.U('WebApp/PhotoBooks/newAddPhotoToBook'),{media_id:res.serverId,pbId:pbId}, function(json){
									//alert(JSON.stringify(json));
									if(json.code==1){
										logNumber+= json.photoId+',';
										if(i==length){
											var obj={}
											obj.logNum=logNumber.substring(0,logNumber.length-1);
											obj.pbId=pbId;
											$.post(Think.U('WebApp/PhotoBooks/recordLog'),obj, function(json){
												if(json.code==1){
													wstMsg('上传完成');
												}
											})
										}
										var ccc='';
										ccc+='<div class="fang left">';
										ccc+='<input type="hidden" value="'+json.photoId+'">';
										ccc+='<div class="new_book select_'+json.nulPhoto+'">';
										ccc+='<img src="'+WST.ROOT+'/Apps/WebApp/View/default/images/select.png" class="new_img">';
										ccc+='<div class="new_text new_left" onclick="inNewPage('+json.photoId+',this)">新起页</div>';
										ccc+='<div class="new_text new_right" onclick="sureDelPhoto('+json.photoId+',this)">删除</div>';
										ccc+='</div>';
										ccc+='<div class="new_center center_'+json.nulPhoto+'" onclick="inBook('+json.photoId+',this)">当前页</div>';
										ccc+='<img src="'+WST.ROOT+'/'+json.purl+'" class="img" onclick="showSelect('+json.nulPhoto+')">';
										ccc+='</div>';
										$('#reserved').append(ccc);
										ccc='';
									}else if(json.code==2){
										wstMsg("第"+i+"张图片上传失败,请重新上传2");
										window.location.reload();
									}else{
										wstMsg("第"+i+"张图片上传失败,请重新上传0");
										window.location.reload();
									}
								});
								if (i<length) {
									setTimeout(upload,100);
								}
							},//uploadImage-success
							fail: function(res) {
								alert(JSON.stringify(res));
								//wstMsg("上传失败");
							}//uploadImage-fail	
						});//uploadImage
					} //upload
					upload();
				}
			});//chooseimage

		});//click:function
	})//wx.ready

</script>
<script>


	//		$(".rotate").click(function(){
	//			num ++;
	//			$(".fee100").rotate(90*num);
	//		});
	var num =0;

	//旋转图片方法
	function rotateImg(param,id){
		num ++;
		$("#d_"+id).rotate(90*num);
		var transform=$("#d_"+id).css('transform');
//		alert(transform);
		if(num%4==0){
			num=4;
		}
		else if(num%3==0){
			num=3
		}
		else if(num%2==0){
			num=2;
		}else{
			num=1;
		}
		$.post(Think.U('WebApp/PhotoBooks/rotateImg'),{transform:num,id:id}, function(json){
//			alert(JSON.stringify(json));
			if(json.status==1){
				wstMsg("图片旋转成功");
			}



		})


	}
</script>


</body>


</html>